<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>student</title>
<!--        <script type="text/javascript">-->
<!--            function addAction(){-->
<!--                document.name.action="addOrUpdate";-->
<!--                document.name.submit();-->
<!--            }-->
<!--            function searchAction(){-->
<!--                document.name.action="selAllLike";-->
<!--                document.name.submit();-->
<!--            }-->
<!--        </script>-->
</head>
<body>
<h1>student</h1>
<form action="addOrUpdate" method="post">
    <input type="number" name="sid" placeholder="id，存在则为修改"><br />
    <input type="text" name="sname" placeholder="学生姓名（必填）"><br />
    <input type="number" name="age" placeholder="年龄"><br />
    <input type="text" name="sex" placeholder="性别"><br />
    <input type="number" name="snum" placeholder="学号"><br />
    <input type="number" name="cid" placeholder="班级id（必填）"><br />
    <input type="submit" value="添加/修改">
</form>
<form action="selById">
    <input type="number" name="sid" placeholder="学生id"><br />
    <input type="submit" value="查询">
</form>
<form action="selAllLike">
    <input type="text" name="sname" placeholder="学生姓名"><br />
    <input type="submit" value="模糊查询">
</form>
<form action="selPage">
    <input type="number" name="pr1" placeholder="当前页"><br />
    <input type="number" name="pr2" placeholder="每页行数"><br />
    <input type="submit" value="分页查询">
</form>
<strong th:text="${status_message}">暂无操作</strong>
<table border="1">
    <tr>
        <td>序号</td>
        <td>姓名</td>
        <td>年龄</td>
        <td>性别</td>
        <td>学号</td>
        <td>班级</td>
<!--        <td>入学时间</td>-->
<!--        <td>更新时间</td>-->
        <td>操作</td>
    </tr>
    <!-- thymeleaf遍历 -->
    <tr th:each="student:${studentList}">
        <td th:text="${student.sid}"></td>
        <td th:text="${student.sname}"></td>
        <td th:text="${student.age}"></td>
        <td th:text="${student.sex}"></td>
        <td th:text="${student.snum}"></td>
        <td th:text="${student.cid}"></td>
        <!-- 如果显示时间，为空时会报错 -->
<!--        <td th:text="${student.createTime}"></td>-->
<!--        <td th:text="${student.updateTime}"></td>-->
        <td>
            <a th:href="@{/student/del(sid=${student.sid})}">删除</a>
        </td>
    </tr>
</table>
<h5 th:text="${message}"></h5>
</body>
</html>